<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title></title>
  </head>
  <body>
    <div id="app">
      单价<input type="text" name="" id="" v-model="price">
      数量<input type="text" name="" id="" v-model="count">
      总价格为:{{total|myfilter}}
    </div>
    <script src="./vue.js"></script>
    <script>
      const vm=new Vue({
        el:'#app',
        data:{price:"",count:"",total:""},
        methods:{},
        watch:{
          price(){
            this.total=this.price*this.count
          },
          count(){
            this.total=this.price*this.count
          }
        },
        filters:{
          myfilter(val){
            return val+(val>0?"元":"") 
          }
        }
       })
    </script>
  </body>
</html>